$.ajax({
  type: "GET",
    url: "/api/goods/list",
    success: function (res) {
        console.log(res);
        var htmlStr = template('tpl-goods', res.data)
        $('#g-goods').html(htmlStr)
        var n = 0;
        $.each($(".o-name"), function (i, ele) {
            var name = $(ele).html();
            var search = decodeURIComponent(location.search.split("=")[1]); ;
            console.log(name);
            console.log(search);
            
            if (name.includes(search)) {
                // console.log(666);
                $(ele).parents(".item").show();
                $('.alert').hide()
            } else {
                $(ele).parents(".item").hide();
                 n++
            }
        });
        if ($('.o-name').length == n) {
             $(".alert").show();
        }
        
               

        
  }
});
